
package com.hexinfo.dmpro.sparing.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hexinfo.dmpro.common.utils.CommonConstants;
import com.hexinfo.dmpro.sparing.model.SyncFullAudit;
import com.hexinfo.dmpro.sparing.dao.SyncFullAuditMapper;
import com.hexinfo.dmpro.sparing.model.SyncFullAuditTask;
import com.hexinfo.dmpro.sparing.service.SyncFullAuditService;
import org.springframework.stereotype.Service;

/**
 * 全量稽核日志表（记录表）
 *
 * @author yemw
 * @date 2024-01-30 17:02:18
 */
@Service
public class SyncFullAuditServiceImpl extends ServiceImpl<SyncFullAuditMapper, SyncFullAudit> implements SyncFullAuditService {

    @Override
    public Page queryList(Page page, SyncFullAudit syncFullAudit) {
        LambdaQueryWrapper<SyncFullAudit> wrapper = Wrappers.lambdaQuery();
        wrapper.like(StrUtil.isNotBlank(syncFullAudit.getLibraryTableName()), SyncFullAudit::getLibraryTableName,syncFullAudit.getLibraryTableName())
                .eq(StrUtil.isNotBlank(syncFullAudit.getTaskId()), SyncFullAudit::getTaskId,syncFullAudit.getTaskId())
                .eq(StrUtil.isNotBlank(syncFullAudit.getFlag()), SyncFullAudit::getFlag,syncFullAudit.getFlag())
                .eq(StrUtil.isNotBlank(syncFullAudit.getTaskState()), SyncFullAudit::getTaskState,syncFullAudit.getTaskState())
                .eq(SyncFullAudit::getDel,CommonConstants.STATUS_NORMAL).orderByDesc(SyncFullAudit::getCreateTime);
        Page returnPage = this.baseMapper.selectPage(page, wrapper);
        return returnPage;
    }
}
